package main

import (
	"context"
	"github.com/chromedp/chromedp"
	"log"
	"time"
)

func main() {

	//windowInfo:=domain.WindowInfo{Class: "TkTopLevel", Title: "Ultimate Vocal Remover", BindPara: domain.BindPara{Dx: "dx2", Mouse: "normal", Keyboard: "windows"}}
	//hwnd := server.GetHwnd(windowInfo)
	//println(hwnd.Dm.TestPic())

	// 禁用chrome headless
	opts := append(chromedp.DefaultExecAllocatorOptions[:],
		chromedp.Flag("headless", false),
	)
	allocCtx, cancel := chromedp.NewExecAllocator(context.Background(), opts...)
	defer cancel()

	// create chrome instance
	ctx, cancel := chromedp.NewContext(
		allocCtx,
		chromedp.WithLogf(log.Printf),
	)
	defer cancel()

	// create a timeout
	ctx, cancel = context.WithTimeout(ctx, 24*3600*time.Second)
	defer cancel()

	go func() {
		chromedp.Run(ctx,
			chromedp.Navigate(`http://127.0.0.1:7860/`),
		)
	}()
	time.Sleep(1 * time.Second)
	log.Println("end")
	chromedp.Run(ctx,
		chromedp.Navigate(`http://127.0.0.1:7861/`),
	)
	time.Sleep(20 * time.Second)
}
